//
//  WYHomePageHeaderCell.m
//  Boss
//
//  Created by admin on 2018/7/5.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYHomePageHeaderCell.h"
@interface WYHomePageHeaderCell()
@property (strong, nonatomic) IBOutlet UIImageView *userImageView;
@property (strong, nonatomic) IBOutlet UILabel *userName;
@property (strong, nonatomic) IBOutlet UILabel *dutyLabel;
@property (strong, nonatomic) IBOutlet UILabel *dynamicNum;
@property (strong, nonatomic) IBOutlet UILabel *accessNum;
@property (strong, nonatomic) IBOutlet UILabel *attentionNum;

@property (strong, nonatomic) IBOutlet UIImageView *backgroundImageView;
@property (strong, nonatomic) IBOutlet UIView *mainView;
@property (strong, nonatomic) IBOutlet UIImageView *vipImageView;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageHeight;

@property (strong, nonatomic) IBOutlet UILabel *fansCount;


@end
@implementation WYHomePageHeaderCell
-(void)setModel:(WYUserCenterModel *)model
{
    _model = model;
    [self.userImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",model.userUrl]] placeholderImage:nil];
    self.userName.text = model.userName;
    self.dutyLabel.text =[NSString stringWithFormat:@"%@ %@",@"",model.position?model.position:@""];
    self.dynamicNum.text = [NSString stringWithFormat:@" %@",model.dynamicNum];
    self.accessNum.text = [NSString stringWithFormat:@" %@",model.accessNum];
    self.attentionNum.text = [NSString stringWithFormat:@" %@",model.attentionNum];
    self.fansCount.text = model.fansNum;
  //[self.backgroundImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",model.firmLogo]] placeholderImage:[UIImage imageNamed:@"home_page_back"]];
    
    
}
-(void)setUserMessage:(WYUserMessage *)userMessage
{
    _userMessage = userMessage;
    
    [self.vipImageView showVipImageViewStatusWithVipId:userMessage.vipId];
    
    
    
    
//    if ([userMessage.vipId isEqualToString:@"10"]) {
//        self.vipImageView.image = [UIImage imageNamed:@"白银会员"];
//        self.vipImageView.hidden = NO;
//    }
//    if ([userMessage.vipId isEqualToString:@"20"]) {
//         self.vipImageView.image = [UIImage imageNamed:@"黄金会员"];
//        self.vipImageView.hidden = NO;
//    }
//    if ([userMessage.vipId isEqualToString:@"30"]) {
//        self.vipImageView.image = [UIImage imageNamed:@"diamonds"];
//        self.vipImageView.hidden = NO;
//    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    [self.userImageView setCornerRadius:33.f];
    self.imageHeight.constant = 140*DUP;
    self.backgroundImageView.clipsToBounds = YES;
    UITapGestureRecognizer *ges = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickBackgroundAction)];
    self.backgroundImageView.userInteractionEnabled = YES;
    [self.backgroundImageView addGestureRecognizer:ges];
    self.vipImageView.hidden = YES;
//    UIColor *clr = [UIColor hexStringToColor:@"#A7AFC6" alpha:0.3];
//    //self.backgroundColor = clr;
//    self.mainView.layer.shadowColor = clr.CGColor;
//    self.mainView.layer.cornerRadius = 5;
//    self.mainView.layer.shadowOffset = CGSizeMake(0,0);
//    self.mainView.layer.shadowOpacity = 1.0;
//    self.mainView.layer.shadowRadius = 8;
    
    
    
    
    
    
    // Initialization code
}
-(void)clickBackgroundAction
{
    if ([self.delegate respondsToSelector:@selector(editBackgroundWithImageView:)]) {
        [self.delegate editBackgroundWithImageView:self.backgroundImageView];
    }
}


- (IBAction)editAction:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(didSelectEditButton)]) {
        [self.delegate didSelectEditButton];
    }
}


- (void)layoutSubviews {
    [super layoutSubviews];
    //    self.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(8, self.bounds.size.height/2, self.bounds.size.width-(2*8), self.bounds.size.height/2+3)].CGPath;
 //   self.mainView.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, self.mainView.size.height/3, self.mainView.bounds.size.width, self.mainView.bounds.size.height/3*2)].CGPath;
    
    
}
- (IBAction)dycAction:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickDymicAction)]) {
        [self.delegate clickDymicAction];
    }
}
- (IBAction)followAction:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(clickFollowAction)]) {
        [self.delegate clickFollowAction];
    }
    
    
}



@end
